#include <iostream>

using std::cout;
using std::endl;


int func(int x)
{
    cout << "int func(int)" << endl;
    return x;
}

int add(int y)
{
    return y + 4;
}

int test(int a)
{
    a = 100;
    return a;
}

int func2(int x, int y)
{
    return x + y;
}

int main(int argc, char *argv[])
{
    int number = 10;
    int *pp;

    pp = &number;
    cout << "*pp = " << *pp << endl;//10

    int value = 200;
    pp = &value;
    cout << "*pp = " << *pp << endl;//200
                                    //
    float fa = 22.22;
    /* pp = &fa;//error */

    cout << endl;
    int (*pf)(int);//函数指针
    pf = &func;//函数名是函数的入口地址
    cout << "pf(100) = " << (*pf)(100) << endl;
    cout << "pf(100) = " << pf(100) << endl;

    cout << endl;
    pf = &add;
    cout << "pf(200) = " << (*pf)(200) << endl;
    cout << "pf(200) = " << pf(200) << endl;

    cout << endl;
    /* pf = func2;//error */

    return 0;
}

